<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <link rel="stylesheet" href="__HOME_CSS__/default/css/base.css">
    <link rel="stylesheet" href="__HOME_CSS__/default/css/login.css">
</head>
<body>
    <div class="login">
        <div class="container clearFix">
            <div class="logo">
                <img src="__HOME_CSS__/default/css/images/logo.png" alt="">
            </div>
            <div class="form">
                <form id="loginForm" action="">
                    <div class="account">
                        <input id="username" autocomplete="off" name="username" class="ipt" type="text" placeholder="请输入账号">
                    </div>
                    <div class="pwd">
                        <input id="password" autocomplete="off" name="password" class="ipt" type="password" placeholder="请输入密码">
                    </div>
                    <div class="code clearFix">
                        <input id="code" autocomplete="off" name="code" class="ipt" type="text" placeholder="验证码" style="text-align:left;">
                        <a class="pic" href="javascript:;">
                            <img id="imgcode" style="border-radius: 4px;"  src="/index.php/Register/Verify" alt="">
                            <span id="change">换一个</span>
                        </a>
                    </div>
                    <input class="btn submit" type="button" onclick="btnlogin();" value="立即登录">
                </form>
                <div class="link">
                    <a id="forgetdPwd" href="##">忘记密码</a>
                    <a  href="/index.php/Register/reg">注册</a>
                </div>
            </div>
        </div>
    </div>
    <!-- 找回密码弹窗 Start -->
    <div id="findpwdContainer" >
        <div class="title">找回密码<span class="findClose"></span></div>
        <div class="content">
            <form action="" id="findForm">
                <div class="account">
                    <input id="username2" autocomplete="off" name="username2" class="ipt" type="text" placeholder="请输入账号">
                </div>
                <div class="phone">
                    <input id="phone2" autocomplete="off" name="phone2" class="ipt" type="text" placeholder="请输入手机号码">
                </div>
                <div class="code clearFix">
                    <input id="code2" autocomplete="off" name="code2" class="ipt" type="text" placeholder="验证码">
                    <input id="findSend" type="button" disabled="true" class="send gray" value="发送验证码"  onclick="clickButton(this)">
                </div>
                <div class="password1">
                    <input id="password1" autocomplete="off" name="password1" class="ipt" type="password" placeholder="请输入新密码">
                </div>
                <div class="password2">
                    <input id="password2" autocomplete="off" name="password2" class="ipt" type="password" placeholder="确认密码">
                </div>
                <div class="btn clearFix">
                    <input id="findConfirm" type="submit" value="提交">
                    <input id="findCancel" type="button" value="取消">
                </div>
            </form>
        </div>
    </div>
    <!-- 找回密码弹窗 End -->
    <!-- 注册弹窗 Start -->
    <div id="regContainer" >
        <div class="title">注册<span class="regClose"></span></div>
        <div class="content">
            <form action="" id="regForm">
                <div class="account">
                    <input id="username3" autocomplete="off" name="username3" class="ipt" type="text" placeholder="用户名4-10位字符">
                </div>
                <div class="phone">
                    <input id="phone3" autocomplete="off" name="phone3" class="ipt" type="text" placeholder="请输入手机号码">
                </div>
                <div class="wx">
                    <input id="wx3" autocomplete="off" name="wx3" class="ipt" type="text" placeholder="请输入微信号">
                </div>
                <div class="password1">
                    <input id="password3" autocomplete="off" name="password3" class="ipt" type="password" placeholder="密码6-20位字符">
                </div>
                <div class="password2">
                    <input id="password4" autocomplete="off" name="password4" class="ipt" type="password" placeholder="确认密码">
                </div>
                <div class="code clearFix">
                    <input id="code3" autocomplete="off" name="code3" class="ipt" type="text" placeholder="验证码">
                    <input type="button" disabled="true" id="regSend" class="send gray" value="发送验证码"  onclick="clickButton(this)">
                </div>
                <div class="btn clearFix">
                    <input id="regConfirm" type="submit" value="提交">
                    <input id="regCancel" type="button" value="取消">
                </div>
            </form>
        </div>
    </div>
    <!-- 注册弹窗 End -->
    <!-- 遮罩 -->
    <div class="mask"></div>
</body>


<script src="__HOME_CSS__/default/js/jquery-1.11.3.js"></script>
<script src="__HOME_CSS__/default/js/jquery.validate.min.js"></script>
<script src="__HOME_CSS__/default/js/messages_zh.js"></script>
<script src="__HOME_CSS__/default/js/login.js"></script>
<script src="__HOME_CSS__/default/js/layer/layer.js"></script>

<script>
	var verifyimg = $("#imgcode").attr("src");
	$("#change").click(function(){
		if(verifyimg.indexOf('?')>0){
			$("#imgcode").attr("src",verifyimg+'&random='+Math.random());
		}else{
			$("#imgcode").attr("src",verifyimg+'?random'+Math.random());
		}
	})
function btnlogin(){
  var g = $("input[name=username]").val() == undefined ? "" : $("input[name=username]").val().trim();
  if (g == "") {
    layer.alert("请输入账号！");
    return
  }
  var j = $("input[name=password]").val();
  if (j == "") {
    layer.alert("请输入密码！");
    return
  }
  var k = $("input[name=code]").val();
  if (k == "") {
    layer.alert("请输入验证码！");
    return
  }
	$.post('<?php echo U('Home/Login/dologin')?>',{name:g,pwd:j,code:k},function(e){
		if(e.result==1){
		
		window.location.href='<?php echo U('Home/Login/agreement')?>';

		}else{
		$("#imgcode").attr("src",verifyimg+'?random'+Math.random());
		$("#code").val('');
		layer.alert(e.message);
		
      return
		}
		},'json')

}
	
</script>
</html>